package com.book.bridge.function;

import com.book.pojo.UserInfo;
import com.book.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;

@Component
public class RegisterLoginByDefault extends  AbstractRegisterLoginFun implements RegisterLoginFuncInterface{

    @Autowired
    UserInfoService userInfoService;

    /**
     * 登录 重构 ，之前的逻辑直接拿过来
     * @param account
     * @param password
     * @return
     */
    @Override
    public String login(String account, String password) {
       return commonLogin(account,password,userInfoService);

    }

    /**
     * 注册 重构 之前的逻辑直接拿过来
     * @param userInfo
     * @return
     */
    @Override
    public String register(UserInfo userInfo) {
        return commonRegister(userInfo,userInfoService);

    }

    /**
     * 存在 重构
     * @param username
     * @return
     */
    @Override
    public boolean checkUserExists(String username) {
        return commonCheckUserExists(username,userInfoService);
    }


}
